package cc.avatar.model.rule;

import cc.avatar.model.AccountingEvent;
import cc.avatar.model.PostingRule;
import cc.avatar.model.Sale;

/** 按总块数乘以单价 */
public class SaleCommisionPR extends PostingRule{
    private int price;
    
    public SaleCommisionPR(String parameter){
    	this(Integer.valueOf(parameter));
    }
    
    public SaleCommisionPR(int price){
    	this.price = price;
    }
	
    @Override
    public double calculateAmount(AccountingEvent evt){
		Sale sale = (Sale) evt;
		return sale.getTotalAmount() * price;
	}
}
